import { lazy } from "react";
import { createBrowserRouter } from 'react-router-dom'
import {
  MenuFoldOutlined,
  MenuUnfoldOutlined,
  UploadOutlined,
  UserOutlined,
  VideoCameraOutlined,
} from '@ant-design/icons';

const App = lazy(() => import('../App'))
const Home = lazy(() => import('../pages/home/Index'))
const Home1 = lazy(() => import('../pages/home/home1/Index'))
const Table = lazy(() => import('../pages/table/Index'))
const Order = lazy(() => import('../pages/order/Index'))

type homeRouter = {
  path: string;
  element: JSX.Element;
  children?: homeRouter;
  icon?: any;
  label?: string;
}[]

export const homeRoutes: homeRouter = [
  {
    path: '/home',
    element: <Home />,
    icon: <MenuFoldOutlined />,
    label: "首页",
    children: [
      {
        path: '/home/home1',
        element: <Home1 />,
        icon: <MenuFoldOutlined />,
        label: "Tab切换",
      }
    ]
  },
  {
    path: '/table',
    element: <Table />,
    icon: <UploadOutlined />,
    label: "表格"
  }
]

const routes: homeRouter = [
  {
    path: '/',
    element: <App />,
    children: homeRoutes
  },
  {
    path: '/order',
    element: <Order />,
  }
]
const router = createBrowserRouter(routes)

export default router